<?php

namespace App\Models\Setting\Repository;

use App\Models\Setting\Model\Unit;
use App\Models\Setting\Model\UnitType;
use Illuminate\Database\Eloquent\Model;

class UnitRepository extends Model{


    protected $unit;

    public function __construct()
    {
        $this->unit = new Unit();
    }


    public function statusArray()
    {
        return [
            UnitType::UP=>'启用',
            UnitType::DOWN=>'关闭'
        ];
    }

    public function getShopType()
    {
        return Unit::where([
            'type'=>UnitType::TYPE_SHOP
        ])->get()->pluck('text','id');
    }

    public function getUnitType()
    {
        return Unit::where([
            'type'=>UnitType::TYPE_MONEY
        ])->get()->pluck('text','id');
    }

    public function getPayWayType()
    {
        return Unit::where([
            'type'=>UnitType::TYPE_PAY_WAY
        ])->get()->pluck('text','id');
    }
}

